{include file="public/header"}

<body>
  <div class="layui-fluid">
    <div class="layui-row">
      <form action="" method="post" class="layui-form layui-form-pane">
        <div class="layui-card layui-form" lay-filter="component-form-element">
          <div class="layui-card-header">用户账号</div>
          <div class="layui-card-body layui-row layui-col-space10">
            <div class="layui-col-md12">
              <input type="text" id="title" name="account" value="{$row.account|default=''}" required=""
                lay-verify="required" autocomplete="off" class="layui-input" />
            </div>
          </div>
        </div>
        <div class="layui-card layui-form" lay-filter="component-form-element">
          <div class="layui-card-header">备注信息</div>
          <div class="layui-card-body layui-row layui-col-space10">
            <div class="layui-col-md12">
              <input type="text" id="title" name="remark" value="{$row.remark|default=''}" required=""
                lay-verify="required" autocomplete="off" class="layui-input" />
            </div>
          </div>
        </div>
        <div class="layui-card layui-form" lay-filter="component-form-element">
          <div class="layui-card-header">邮寄通知次数修改</div>
          <div class="layui-card-body layui-row layui-col-space10">
            <div class="layui-col-md12">
              <input type="number" id="hjtz" name="hjtz" value="{$row.hjtz|default='0'}" required=""
                lay-verify="required" autocomplete="off" class="layui-input" />
            </div>
          </div>
        </div>
        <div class="layui-card layui-form" lay-filter="component-form-element">
          <div class="layui-card-header">联系电话</div>
          <div class="layui-card-body layui-row layui-col-space10">
            <div class="layui-col-md12">
              <input type="text" id="mobile" name="mobile" value="{$row.mobile|default=''}" required=""
                lay-verify="required" autocomplete="off" class="layui-input" />
            </div>
          </div>
        </div>
        
        <div class="layui-card layui-form" lay-filter="component-form-element">
          <div class="layui-card-header">附近店铺可见公里范围(单位:km)</div>
          <div class="layui-card-body layui-row layui-col-space10">
            <div class="layui-col-md12">
              <input type="text" id="km" name="km" value="{$row.km|default='100'}" required="" lay-verify="required"
                autocomplete="off" class="layui-input" />
            </div>
          </div>
        </div>
        <div class="layui-card layui-form" lay-filter="component-form-element">
          <div class="layui-card-header">附近店铺地图自由选点开关(选址和开业派单人员无此限制)</div>
          <div class="layui-card-body layui-row layui-col-space10">
            <div class="layui-col-md12">
              <input type="radio" name="yuancheng" lay-filter="yuancheng" value="1" {if empty($row.yuancheng) ||
                $row.yuancheng==1}checked{/if} title="关">
              <input type="radio" name="yuancheng" lay-filter="yuancheng" value="2" {if !empty($row.yuancheng) &&
                $row.yuancheng==2}checked{/if} title="开">
            </div>
          </div>
        </div>
        <div class="layui-card layui-form" lay-filter="component-form-element">
          <div class="layui-card-header">预支开关</div>
          <div class="layui-card-body layui-row layui-col-space10">
            <div class="layui-col-md12">
              <input type="radio" name="yuzhi" lay-filter="yuzhi" value="1" {if empty($row.yuzhi) ||
                $row.yuzhi==1}checked{/if} title="关">
              <input type="radio" name="yuzhi" lay-filter="yuzhi" value="2" {if !empty($row.yuzhi) &&
                $row.yuzhi==2}checked{/if} title="开">
            </div>
          </div>
        </div>
        <div class="layui-card layui-form" lay-filter="component-form-element">
          <div class="layui-card-header">类型</div>
          <div class="layui-card-body layui-row layui-col-space10">
            <div class="layui-col-md12">
              <select name="type" lay-verify="" lay-filter="type">
                <option value="0">选择类型</option>
                {foreach :config('config.typepeople') as $k => $v}
                <option value="{$k}" {if !empty($row.type) && $row.type==$k}selected{/if}> {$v|default=''}</option>
                {/foreach}
              </select>
            </div>
          </div>
        </div>
        <div class="layui-card layui-form" lay-filter="component-form-element">
          <div class="layui-card-header">报销管理</div>
          <div class="layui-card-body layui-row layui-col-space10">
            <div class="layui-col-md12">
              <select name="bx" lay-verify="" lay-filter="bx">
                <option value="0">总管理</option>
                {foreach $adminlist as $k => $v}
                <option value="{$v.id}" {if !empty($row.bx) && $row.bx==$v.id}selected{/if}> {$v.username}({$v.nickname|default=''})</option>
                {/foreach}
              </select>
            </div>
          </div>
        </div>
        <div class="layui-card layui-form" id="provinceshow" {if empty($row.type) || ($row.type!=3 &&
          $row.type!=2)}style="display:none" {/if}>
          <label class="layui-form-label">
            <font color="red">* </font>细分类型
          </label>
          <div class="layui-input-block">
            <input type="radio" name="sonstype" lay-filter="sonstype" value="1" {if empty($row.sonstype) ||
              $row.sonstype==1}checked{/if} title="售后:经理|督导:督导">
            <input type="radio" name="sonstype" lay-filter="sonstype" value="2" {if !empty($row.sonstype) &&
              $row.sonstype==2}checked{/if} title="售后:助理|督导:专员">
          </div>
        </div>
        <div class="layui-card layui-form" lay-filter="component-form-element">
          <div class="layui-card-header">负责项目(可多选，不选表示无组别)</div>
          <div class="layui-card-body layui-row layui-col-space10">
            <div class="layui-col-md12">
              {foreach $grouplist as $k => $v}
              {if $k != 1}
              <input name="groups[]" lay-skin="primary" type="checkbox" value="{$k}" title="{$v}" {if
                !empty($row.groups) && in_array($k, $row.groups) && $row.groups>= 0} checked {/if}>
              {/if}
              {/foreach}
            </div>
          </div>
        </div>
        <div class="layui-card layui-form" lay-filter="component-form-element">
          <div class="layui-card-header">是否仅查看</div>
          <div class="layui-card-body layui-row layui-col-space10">
            <div class="layui-col-md12">
              <select name="look" lay-verify="" lay-filter="look">
                <option value="1" {if !empty($row.look) && $row.look==1}selected{/if}>可操作可查看</option>
                <option value="2" {if !empty($row.look) && $row.look==2}selected{/if}>不可操作仅查看</option>
              </select>
            </div>
          </div>
        </div>
        <div class="layui-card layui-form" lay-filter="component-form-element">
          <div class="layui-card-header">
            账号密码(新账号必须填写，老账号填写进行修改)
          </div>
          <div class="layui-card-body layui-row layui-col-space10">
            <div class="layui-col-md12">
              <input type="password" id="title" name="password" autocomplete="off" class="layui-input" />
            </div>
          </div>
        </div>
        <div class="layui-form-item">
          <input type="hidden" value="{$row['id']|default='0'}" name="id" />
          <button class="layui-btn" lay-submit="" lay-filter="add">提交</button>
        </div>
      </form>
    </div>
  </div>
  {include file="public/footer"}
  <script>
    layui.use(["form", "layer", "upload"], function () {
      $ = layui.jquery;
      var form = layui.form,
        upload = layui.upload,
        element = layui.element,
        layer = layui.layer;
      form.on('select(type)', function (data) {
        var type = data.value;
        if (type == 3 || type == 2) {
          $('#provinceshow').show();
        } else {
          $('#provinceshow').hide();
        }
      });
      //监听提交
      form.on("submit(add)", function (data) {
        //发异步，把数据提交给php
        $.ajax({
          type: "post",
          data: data.field,
          success: function (res) {
            if (res.status == 0) {
              layer.msg(res.msg, { icon: 6, time: 1000 }, function () {
                // 获得frame索引
                var index = parent.layer.getFrameIndex(window.name);
                parent.location.reload();
                parent.layer.close(index);
              });
            } else {
              layer.msg(res.msg, { icon: 2, time: 1000 });
            }
          },
        });
        return false;
      });
    });
  </script>
</body>